<template>
  <!--  <router-view/>-->
  <router-view v-slot="{ Component }">
    <transition :name="$router.customRouterData.transitionName">
      <component :is="Component"/>
    </transition>
  </router-view>
  <transition name="fade" mode="out-in">
    <van-overlay :show="loadingShow" :z-index="4000">
      <van-loading color="#ffffff" class="loading_box" type="spinner" vertical size="50px">
        <span style="font-size: 18px">{{ $t('加载中') }}</span>
      </van-loading>
    </van-overlay>
  </transition>
</template>

<script>
import {computed, onMounted, ref, watch} from 'vue'
import {useI18n,} from 'vue-i18n'
import {useRoute, useRouter} from 'vue-router'
import {useStore} from "vuex";
import {Toast} from "vant";

export default {
  setup() {

    const {t} = useI18n()
    const fadeName = ref(null)
    const routes = useRoute()
    const router = useRouter()
    const store = useStore()
    const loadingShow = computed(() => {
      return store.getters.getViewLoading
    })
    const token = localStorage.getItem('token')


    async function userPermissHref() {
      // 没有登录的用户默认拦截登录页
      if (!token) {
        router.replace('/JFLAWJLfjkw')
      }

    }

    watch(() => routes.path, (value) => {

      store.dispatch('changeLoading', true)
    })
    onMounted(() => {
      userPermissHref()
    })
    return {
      loadingShow,
      fadeName,
    }
  }
}
</script>

<style lang="less">
.slide_left-enter-active, .slide_left-leave-active, .slide_right-enter-active, .slide_right-leave-active {
  transition: all .5s;
  position: absolute !important;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1;
}

.slide_left-enter-from, .slide_right-leave-to {
  opacity: 1;
  transform: translateX(100%);
}

.slide_right-enter-from, .slide_left-leave-to {
  opacity: 1;
  transform: translateX(-100%);
}

.slide_left-leave-to, .slide_right-leave-to {
  opacity: 0.5;
}


.dialog_body {
  background: #FFFFFF;
  border-radius: 10px;
  width: 80vw;
  height: 100%;
  padding: 15px;
  font-size: 16px;
  text-align: center;
  position: relative;

  .title {
    color: #FF7805;
    font-size: 18px;
    padding: 10px 0;
  }

  .reject_btn {
    background-color: #BCBCBC;
    color: #FFFFFF;
    width: 60%;
    margin-top: 20px;
  }

  .content_text {
    font-weight: 600;
    margin-top: 30px;

    .active {
      font-size: 26px;
      color: #FF7A00;
    }
  }
}

.tab_nav_icon_left {
  background-color: #ffffff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  width: 40px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  border-radius: 6px;
}

.tab_progress {
  padding: 10px;
  display: flex;
  font-size: 16px;

}

.van-swipe__track {
  background-color: #fff;
}

.van-cascader__header {
  display: none !important;
}

// 单元格
.cell_content_list {
  border-radius: 8px;
  padding: 0 15px;

  .cell_content_item {
    margin-bottom: 15px;
    box-sizing: border-box;
    border-radius: 5px;
    font-size: 14px;
    color: #666666;

    .text {
      margin-bottom: 5px;
    }

    .input {
      width: 100%;
      padding: 10px;
      height: 45px;
      line-height: 45px;
      border-radius: 10px;
      border: 0;
      box-sizing: border-box;
      color: #333333;
    }

    .input::placeholder {
      color: #9F9DAB;
    }

    .input_icon {
      position: absolute;
      height: 6px;
      width: 10px;
      top: 50%;
      right: 10px;
      transform: translate(-50%, -50%)
    }
  }
}


.fade-enter-active, .fade-leave-active {
  transition: opacity .3s;
}

.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  min-height: 100%;
  min-width: 100%;
  background-color: #F7F7F7;
  z-index: -1;
}

html, body {
  height: 100%;
  margin: 0;
}


.loading_box {
  position: relative;
  padding-top: 30vh;
  color: #FFFFFF;
  width: 100%;
  height: 100%;
  z-index: 4000;
}

.money_symbol {
  font-size: 16px;
  vertical-align: middle;
}

.symbol {
  font-size: 16px;
  line-height: 20px;
  display: inline-block;
  transform: translateY(4px);
  margin-right: 2px;
}

.confirm {
  width: 250px;
  color: #ffffff;
  border: none;
  font-size: 18px;
}

.loading_wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.next_confirm {
  width: 100%;
  font-size: 20px !important;
  font-weight: 600;
}

.van-popover {
  width: 300px;
}
.van-popover__content .van-popover__action{
  text-align: left;
  width: 300px;
}
.van-popover__action-text{
  flex: 0!important;
}
.flex_center {
  display: flex;
  align-items: center;
}

.tab_nav_bg {
  padding-top: 20px;
  height: 200px;
  color: #FFFFFF;
  font-size: 24px;
  border-radius: 0 0 10px 10px;
  background-image: url("./assets/login_bg.png");
  background-size: 100% 100%;
}

.nav_left_icon {
  background-color: rgb(255, 255, 255, 0.5);
  color: #333333;
  padding: 5px;
  border-radius: 50%;
  margin-left: 15px;
}
</style>
